package org.fuys.coder.infrastructure.model.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;

/**
 * 
 * @TableName user
 */
@TableName(value ="user")
@Data
public class User implements Serializable {
    /**
     * 用户id 唯一
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 用户昵称 不唯一
     */
    private String nickName;

    /**
     * 用户密码 不唯一
     */
    private String password;

    /**
     * 登录所需邮箱 唯一
     */
    private String email;

    /**
     * 头像 由文件表id关联 不过为了未来可能的历史头像查看 设置为字符串
     */
    private String avatar;

    /**
     * 第三方登录id
     */
    private String platformId;

    /**
     * 第三方登录平台类型
     */
    private String platformType;

    /**
     * 粉丝数
     */
    private Integer followerCount;

    /**
     * 内容数
     */
    private Integer substanceCount;

    /**
     * 获赞数
     */
    private Integer likeCount;

    /**
     * 受收藏数
     */
    private Integer favCount;

    /**
     * 注册时间
     */
    private Date createTime;

    /**
     * 用户简介
     */
    private String introduce;

    /**
     * 此用户状态 表示此用户的状态 0为正常 1为封禁 2为注销
     */
    private Integer status;

    /**
     * 用户的积分 由处理器链路的最后一步送积分 50积分
     */
    private Integer points;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        User other = (User) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getNickName() == null ? other.getNickName() == null : this.getNickName().equals(other.getNickName()))
            && (this.getPassword() == null ? other.getPassword() == null : this.getPassword().equals(other.getPassword()))
            && (this.getEmail() == null ? other.getEmail() == null : this.getEmail().equals(other.getEmail()))
            && (this.getAvatar() == null ? other.getAvatar() == null : this.getAvatar().equals(other.getAvatar()))
            && (this.getPlatformId() == null ? other.getPlatformId() == null : this.getPlatformId().equals(other.getPlatformId()))
            && (this.getPlatformType() == null ? other.getPlatformType() == null : this.getPlatformType().equals(other.getPlatformType()))
            && (this.getFollowerCount() == null ? other.getFollowerCount() == null : this.getFollowerCount().equals(other.getFollowerCount()))
            && (this.getSubstanceCount() == null ? other.getSubstanceCount() == null : this.getSubstanceCount().equals(other.getSubstanceCount()))
            && (this.getLikeCount() == null ? other.getLikeCount() == null : this.getLikeCount().equals(other.getLikeCount()))
            && (this.getFavCount() == null ? other.getFavCount() == null : this.getFavCount().equals(other.getFavCount()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getNickName() == null) ? 0 : getNickName().hashCode());
        result = prime * result + ((getPassword() == null) ? 0 : getPassword().hashCode());
        result = prime * result + ((getEmail() == null) ? 0 : getEmail().hashCode());
        result = prime * result + ((getAvatar() == null) ? 0 : getAvatar().hashCode());
        result = prime * result + ((getPlatformId() == null) ? 0 : getPlatformId().hashCode());
        result = prime * result + ((getPlatformType() == null) ? 0 : getPlatformType().hashCode());
        result = prime * result + ((getFollowerCount() == null) ? 0 : getFollowerCount().hashCode());
        result = prime * result + ((getSubstanceCount() == null) ? 0 : getSubstanceCount().hashCode());
        result = prime * result + ((getLikeCount() == null) ? 0 : getLikeCount().hashCode());
        result = prime * result + ((getFavCount() == null) ? 0 : getFavCount().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", nickName=").append(nickName);
        sb.append(", password=").append(password);
        sb.append(", email=").append(email);
        sb.append(", avatar=").append(avatar);
        sb.append(", platformId=").append(platformId);
        sb.append(", platformType=").append(platformType);
        sb.append(", followerCount=").append(followerCount);
        sb.append(", substanceCount=").append(substanceCount);
        sb.append(", likeCount=").append(likeCount);
        sb.append(", favCount=").append(favCount);
        sb.append(", createTime=").append(createTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}